


CSPLIT(1L)        MISC. REFERENCE MANUAL PAGES         CSPLIT(1L)



NAME
     csplit - split a file into sections  determined  by  context
     lines

SYNOPSIS
     csplit  [-sk]  [-f  prefix]  [-n  digits]  [--prefix=prefix]
     [--digits=digits]  [--quiet]  [--silent] [--keep-files] file
     pattern...

DESCRIPTION
     This manual  page  documents  the  GNU  version  of  csplit.
     csplit creates zero or more output files containing sections
     of the given input _f_i_l_e, or the standard input if  the  name
     `-' is given.  By default, csplit prints the number of bytes
     written to each output file after it has been created.

     The contents of the output files are determined by the  _p_a_t_-
     _t_e_r_n  arguments.   An  error  occurs  if  a pattern argument
     refers to a nonexistent line of the input file, such  as  if
     no  remaining  line matches a given regular expression.  The
     types of pattern arguments are:

          _l_i_n_e
               Create an output file containing the current  line
               up  to  (but  not including) line _l_i_n_e (a positive
               integer) of the input  file.   If  followed  by  a
               repeat  count, also create an output file contain-
               ing the next _l_i_n_e lines of the input file once for
               each repeat.

          /_r_e_g_e_x_p/[_o_f_f_s_e_t]
               Create an output file containing the current  line
               up  to  (but  not  including) the next line of the
               input file that contains a match for _r_e_g_e_x_p.   The
               optional  _o_f_f_s_e_t  is  a  `+'  or `-' followed by a
               positive integer; if it is given,  the  line  that
               starts  the  next section of the input file is the
               line that contains the match for _r_e_g_e_x_p  plus  the
               offset.

          %_r_e_g_e_x_p%[_o_f_f_s_e_t]
               Like the previous type, except that  it  does  not
               create  an  output  file,  so  that section of the
               input file is effectively ignored.

          {_r_e_p_e_a_t-_c_o_u_n_t}
               Repeat the previous pattern _r_e_p_e_a_t-_c_o_u_n_t (a  posi-
               tive integer) additional times.

     The output file names consist of  a  prefix  followed  by  a
     number,  so  that  concatenating  the output files in sorted
     order by file name produces  the  original  input  file,  in



Sun Release 4.1           Last change:                          1






CSPLIT(1L)        MISC. REFERENCE MANUAL PAGES         CSPLIT(1L)



     order.  The default output file name prefix is `xx'.

     By default, if csplit encounters  an  error  or  receives  a
     hangup, interrupt, quit, or terminate signal, it removes any
     output files that it has created so far before it exits.

  OPTIONS
     -_f, --_p_r_e_f_i_x=_p_r_e_f_i_x
          Use _p_r_e_f_i_x as the output file name prefix.

     -_k, --_k_e_e_p-_f_i_l_e_s
          Do not remove output files.

     -_n, --_d_i_g_i_t_s=_d_i_g_i_t_s
          Use output  file  names  containing  numbers  that  are
          _d_i_g_i_t_s digits long instead of the default 2.

     -_s, --_s_i_l_e_n_t, --_q_u_i_e_t
          Do not print counts of output file sizes.

     The long-named options can be introduced with `+' as well as
     `--',  for compatibility with previous releases.  Eventually
     support for `+' will be removed, because it is  incompatible
     with the POSIX.2 standard.































Sun Release 4.1           Last change:                          2



